package file;

import java.io.File;
import java.io.FileFilter;

/**
 * 输出当前目录下所有文本文件(后缀为.txt)
 * @author 范传奇
 *
 */
public class Test {
	public static void main(String[] args) {
		File file = new File(".");
		if(file.isDirectory()) {
			FileFilter filter = new FileFilter() {
				public boolean accept(File f) {					
					return f.getName().endsWith(".txt");
				}	
			};
			File[] subs = file.listFiles(filter);
			for(int i=0;i<subs.length;i++) {
				File sub = subs[i];
				System.out.println(sub.getName());
			}
		}
	}
}






